/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import logic.Boleto;
import logic.Cliente;

/**
 * Clase JPanel que muestra la información del cliente.
 * @author Victoria Fuenmayor y Jose Gabriel Rivera
 */
public class JPanelInfoCliente extends javax.swing.JPanel {
    
    /**
     * Constructor. Encargado de inicializar los componentes gráficos del JPanel.
     */
    public JPanelInfoCliente() {
        initComponents();
    }
    
    /**
     * SetData para tickets comprados.
     * Setea la data del cliente en los Labels correspondientes. Recibe el cliente
     * y el boleto. Muestra la información del cliente y el número y estado del
     * boleto que se le envió.
     * @param cliente
     * @param Ticket 
     */
    public void setData(Cliente cliente, Boleto Ticket){
        this.nombre.setText(cliente.getNombre());
        this.telefono.setText(cliente.getTelefono());
        this.cedula.setText(cliente.getCedula());
        this.nroTickets.setText(Ticket.getNroTicket()+"");
        this.nombre.setVisible(true);
        this.jLabel2.setVisible(true);
        this.jLabel3.setVisible(true);
        this.jLabel4.setVisible(true);
        this.telefono.setVisible(true);
        this.cedula.setVisible(true);
        switch(Ticket.getStatus()){
            case 1: //Disponible
                this.status.setText("Disponible.");
                break;
            case 2: //Reservado
                this.status.setText("Reservado.");
                break;                
            case 3: //Pagado
                this.status.setText("Pagado.");
                break;               
        }
    }
    
    /**
     * SetData para tickets sin comprar.
     * Setea la data del ticket seleccionado y oculta todos los datos del cliente.
     * @param ticket 
     */
    public void setData(Boleto ticket){
        if(ticket.isGanador()){
            this.nombre.setVisible(true);
            this.nombre.setText("No hubo ganador.");
        }else{
            this.nombre.setVisible(false);
        }
        this.jLabel2.setVisible(false);
        this.jLabel3.setVisible(false);
        this.jLabel4.setVisible(false);
        this.telefono.setVisible(false);
        this.cedula.setVisible(false);        
        this.nroTickets.setText(ticket.getNroTicket()+"");
        this.status.setText("Disponible.");
    }    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        nombre = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        telefono = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        cedula = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        nroTickets = new javax.swing.JLabel();
        status = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();

        jLabel2.setText("Nombre:");

        nombre.setText(" ");

        jLabel3.setText("Teléfono:");

        telefono.setText(" ");

        jLabel4.setText("Cédula:");

        cedula.setText(" ");

        jLabel1.setText("Nro. Ticket:");

        nroTickets.setText("    ");

        status.setText(" ");

        jLabel5.setText("Estado:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(nombre, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)
                    .addComponent(telefono, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cedula, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(nroTickets)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(nombre)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(telefono)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cedula)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(nroTickets, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel cedula;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel nombre;
    private javax.swing.JLabel nroTickets;
    private javax.swing.JLabel status;
    private javax.swing.JLabel telefono;
    // End of variables declaration//GEN-END:variables
}
